<?php
/**
 * 店铺处理公共Model类
 */
namespace app\common\model;
use think\Model;

class Shops extends Model
{
    protected $pk = 'sp_id';
	/*
     * @name 指定商户id获取商户名称
     * @author Jin
     * @date 2017.12.21
     * @param $id int 商户id
     * @return string 商户名称
     **/
    public function getNameByShopId($id = '')
    {
        return Shops::where('sp_id', $id)->value('sp_name');
    }

    /**
     * 关联地址区域
     * @return $this
     */
    public function shoparea(){
       return $this->belongsTo('Area','sp_area_id','id')->field('id,merger_name,name');
    }

}